<template>
	<view class="container">
		<up-line-progress activeColor="#282828" :percentage="100" height="4" :showText="false" ></up-line-progress>
		<view style="height: 200rpx;"></view>
		<up-input
		password
		    placeholder="新密码"
		    border="bottom"

			v-model="pwd" 
			@change="achange"
		  ></up-input>
		  <view style="height: 20rpx;"></view>
		  <up-input
		  password
		      placeholder="确认新密码"
		      border="bottom"

		  	v-model="surepwd" 
		  	@change="achangesure"
		    ></up-input>
		<view class="btn" @click="next">
			提交
		</view>
	</view>
	
</template>

<script>
	import { http } from 'uview-plus'
	export default {
	
		data() {
			return {
				pwd:'',
				surepwd:''
			}
		},
		onLoad(options){
			this.phone = options.phone
			this.code = options.code
		},
		methods:{
			achange(value){
				console.log(value)
				this.pwd = value
			},
			achangesure(value){
				this.surepwd = value
			},
			async next(){
				if(this.surepwd != this.pwd){
					uni.showToast({
						title:'两次密码不一致',
						icon:'none'
					})
					return
				}
				console.log(this.phone,this.code,this.pwd,this.surepwd)
				await http.post('/shop/user/password',{phone:this.phone,code:this.code,password:this.pwd,password_confirmation:this.surepwd}).then(res=>{
					console.log(res)
				})
				
			}
		}
	}
</script>

<style lang="scss">
	.container{
		width: 654rpx;
		margin: 60rpx auto;
		.btn{
			width: 654rpx;
			height: 90rpx;
			border-radius: 16rpx;
			opacity: 1;
			color: #fff;
			font-size: 36rpx;
			line-height: 90rpx;
			text-align: center;
			background: #0B9EE2;
			margin-top: 200rpx;
		}
	}
</style>